package org.nepu.scr.indexrate.converter.riskrate.equipmentrisk;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.riskrate.equipmentrisk.TravellingBlockB222;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class TravellingBlockB222Converter implements AttributeConverter<TravellingBlockB222, String> {
    @Override
    public String convertToDatabaseColumn(TravellingBlockB222 travellingBlockB222) {
        return JSONUtil.toJsonStr(travellingBlockB222);
    }

    @Override
    public TravellingBlockB222 convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, TravellingBlockB222.class);
    }
}
